import request from "@/API/request"
import qs from 'qs'

// 请求角色数据
// export const roleDataApi = (params) => request.get(`/prod-api/system/role/list`,  qs.stringify({params}) )
export const roleDataApi = (params) => request.get(encodeURI(`/prod-api/system/role/list`), { params })
// export const roleDataApi = (params) => request.get(encodeURI(`/prod-api/system/role/list?params[beginTime]=${params.beginTime}&params[endTime]=${params.endTime}}`), { params })

// 修改用户状态
export const roleStateApi = (params) => request.put("/prod-api/system/role/changeStatus", params)

// 获取状态选项
export const StateOptionApi = () => request.get("/prod-api/system/dict/data/type/sys_normal_disable")

// 获取菜单权限数据
export const menuTreeselectApi = () => request.get("/prod-api/system/menu/treeselect")

// 获取指定用户的信息
export const roleIdApi = (roleId) => request.get(`/prod-api/system/role/${roleId}`)

// 获取指定角色数据的菜单数据
export const roleMenuTreeselectApi = (roleId) => request.get(`/prod-api/system/menu/roleMenuTreeselect/${roleId}`)

// 获取指定角色数据的菜单数据
export const addRoleApi = (params) => request.post('/prod-api/system/role', params)

// 修改指定角色
export const editRoleApi = (params) => request.put('/prod-api/system/role', params)

// 删除指定角色`
export const delRoleApi = (roleIds) => request.delete(`/prod-api/system/role/${roleIds.join(",")}`)

// 角色导出
export const exportRoleApi = (params) => request.post("/prod-api/system/role/export", qs.stringify(params), { responseType: "blob" })